package com.foreknow.demo6;

public class Test {
    public static int add(int a,int b) throws NegativeNumberException {
        if(a<0||b<0) {
            throw new NegativeNumberException();
        }
        return a + b;
    }

    public static void main(String[] args) {
        try {
            int x = Test.add(-3,5);
            System.out.println(x);
        } catch (NegativeNumberException e) {
            e.printStackTrace();
        }
    }
}
